﻿@{
	Layout = "~/Views/Shared/_Layout.cshtml";
}

@model dPet.Application.DataObjects.ProductCategoryDto

<div class="page-header">
	<h3>编辑商品大类</h3>
</div>

@using (Html.BeginForm("SaveCategory", "Product", FormMethod.Post, new { onsubmit = "return check_form()" }))
{
	<div class="panel panel-default">
		<div class="panel-heading">&nbsp;</div>

		<div class="panel-body form-horizontal">
			@Html.HiddenFor(x => x.Id)
			@Html.HiddenFor(x => x.HospitalId)

			<div class="form-group">
				<label for="Name" class="col-md-1 control-label">名　称</label>
				<div class="col-md-3">
					@Html.TextBoxFor(x => x.Name, new { @class = "form-control", placeholder = "请输入大类名称" })
				</div>
			</div>

			<div class="form-group">
				<div class="col-md-offset-1 col-sm-10">
					<button type="button" class="btn btn-default btn-sm" onclick="window.history.go(-1);"><span class="glyphicon glyphicon-chevron-left"></span> 返 回</button>
					<button type="submit" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-floppy-disk"></span> 保 存</button>
				</div>
			</div>
		</div>
	</div>
}

@section scripts {
	<script type="text/javascript">
		$(document).ready(function () {
			set_left_nav('#ln_ProductCategoryList');
		});

		function check_form() {
			if ($.trim($("#Name").val()) == '') {
				alert("请输入大类名称");
				$("#Name").focus();
				return false;
			}

			return true;
		}
	</script>
}
